package com.cn.baseModel;

import lombok.Data;

@Data
public class DataResponse {
    private String code;
    private String message;
    private Object Data;

    /**
     *  成功返回
     * @param object
     * @return res
     */
    public static DataResponse success(Object object){
        DataResponse res = new DataResponse();
        res.setCode("0000");
        res.setMessage("调用成功");
        res.setData(object);
        return res;
    }

    /**
     * 处理失败时返回
     * @param message 失败信息
     * @param code 失败编码
     * @return res
     */
    public static DataResponse error(String message,String code){
        DataResponse res = new DataResponse();
        res.setCode(code);
        res.setMessage(message);
        return res;
    }

}
